import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class Tracker {
	private final Map<String, Point> map;
	private final Map<String, Point> unmodifiableMap;

	public Tracker(Map<String, Point> map) {
		if (map != null) {
			this.map = Collections.synchronizedMap(new HashMap<String, Point>(
					map));
		} else {
			this.map = Collections
					.synchronizedMap(new HashMap<String, Point>());
		}
		this.unmodifiableMap = Collections.unmodifiableMap(this.map);
	}

	public Point getLoc(String id) {
		synchronized (map) {
			return map.get(id);
		}
	}

	public void setLoc(String id, Point point) {
		synchronized (map) {
			map.put(id, point);
		}
	}

	public Map<String, Point> getLocations() {
		return unmodifiableMap;
	}
}
